﻿using Corina.DataContext.DatabaseOperator;
using Corina.Datamodel.Base;
using Corina.Infrastructure;
using Corina.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Corina.DataContext.Service
{
    public class ServiceBase : BaseClass
    {
        protected DatabaseOperatorBase DbOperator
        {
            get
            {
                return GetInstance<DatabaseOperatorBase>();
            }
        }

        protected T GetInstance<T>(params object[] paras) where T : BaseClass
        {
            return InstanceHelper.GetInstance<T>(paras);
        }

        public bool Exists<T>(string connectionString, List<string> properties, List<object> values) where T : DatamodelEntityBase, new()
        {
            return DbOperator.Exists<T>(connectionString, properties, values);
        }
    }
}
